//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.

#ifndef TACHOMETERWIDGET_H
#define TACHOMETERWIDGET_H

#include <QtGui/QFrame>
#include <QSettings>
#include <QTimer>
#include "tachometer.h"
#include "cangateway.h"

namespace Ui {
    class TachometerWidget;
}

/*
  TachometerWidget is a GUI for Tachometer.

  TachometerWidget is responsible for binding all Tachometer's
  functionalities with a GUI. Besides it is responsible for
  setting up a timer which fires requestSpeed() every 1000 ms.

  Newly created TachometerWidget sets up manual controll mode for
  the underlying Tachometer.

  It has setLogTextEdit function, which allows to bind Tachometer
  logger to the outer field.
 */
class TachometerWidget : public QFrame {
    Q_OBJECT
public:
    TachometerWidget(quint16 baseID, CanGateway * canGateway, QWidget *parent = 0);
    virtual ~TachometerWidget();
    void setLogTextEdit(QTextEdit *logTextEdit);
    quint16 getBaseID();

private:
    Ui::TachometerWidget *m_ui;
    Tachometer *tachometer;
    QTextEdit *logTextEdit;


private slots:
    void on_closeButton_clicked();
    void on_sendButton_clicked();
};

#endif // TACHOMETERWIDGET_H
